"""
File: departments.py
Author: ershixiong
Date: 2023/12/25
describe:

"""

from hogwarts.WeworkApi.apis.wework import Wework


class Departments(Wework):

    def create(self, data):
        url = 'department/create'

        pay_load = {
            'method': 'post',
            'url': url,
            'json': data

        }
        res = self.send(pay_load)
        return res

    def update(self, data):
        url = 'department/update'

        pay_load = {
            'method': 'post',
            'url': url,
            'json': data

        }

        res = self.send(pay_load)
        return res

    def delete(self, id):
        url = 'department/delete'
        params = {
            'id': id,
        }

        pay_load = {
            'method': 'get',
            'url': url,
            'params': params
        }

        res = self.send(pay_load)
        return res

    def list(self, id):
        url = 'department/simplelist'
        params = {
            'id': id
        }
        pay_load = {
            'method': 'get',
            'url': url,
            'params': params
        }

        res = self.send(pay_load)
        return res
